set(sources
    adddvscf.f90
    adddvhubscf.f90
    addusdbec.f90
    addusdbec_nc.f90
    apply_dpot.f90
    apply_dpot_mod.f90
    addusldos.f90
    adddvepsi_us.f90
    cft_wave.f90
    cgsolve_all.f90
    cg_psi.f90
    ch_psi_all.f90
    Coul_cut_2D_ph.f90
    check_q_points_sym.f90
    dfpt_tetra_mod.f90
    dynmat_sub.f90
    h_prec.f90
    incdrhoscf.f90
    incdrhoscf_nc.f90
    dv_of_drho.f90
    dgradcorr.f90
    dnonloccorr.f90
    dv_vdW_DF.f90
    dv_rVV10.f90
    newdq.f90
    orthogonalize.f90
    setup_nscf.f90
    set_dbecsum_nc.f90
    set_int3_nc.f90
    smallgq.f90
    lr_sm1_psi.f90
    lr_addusddens.f90
    localdos.f90
    setup_dgc.f90
    compute_vsgga.f90
    setup_dmuxc.f90
    setup_nbnd_occ.f90
    setup_alpha_pv.f90
    set_small_group_of_q.f90
    sgam_lr.f90
    star_q.f90
    setqmod.f90
    lr_orthoUwfc.f90
    qdipol_cryst.f90
    mode_group.f90
    mix_pot.f90
    lrcom.f90
    lr_dot.f90
    lr_dot_magnons.f90
    lanczos_pseudohermitian.f90
    lanczos_nonhermitian.f90
    lanczos_pseudohermitian_c.f90
    lanczos_nonhermitian_c.f90
    set_kplusq_nc.f90
    lr_sym_mod.f90
    ccg_psi.f90
    ccgsolve_all.f90
    ch_psi_all_complex.f90
    addusddenseq.f90
    response_kernels.f90
    efermi_shift.f90)
qe_enable_cuda_fortran("${sources}")
qe_add_library(qe_lr_modules ${sources})
target_link_libraries(qe_lr_modules
    PRIVATE
        qe_openacc_fortran
	qe_openmp_fortran
	qe_mpi_fortran
        qe_modules
        qe_pw
        qe_upflib
        qe_fftx
        qe_xclib
	qe_device_lapack)

if(QE_ENABLE_CUDA)
    target_link_libraries(qe_modules
        PRIVATE
            CUDA::cublas)
endif()

###########################################################

qe_install_targets(qe_lr_modules)
